//
//  ChongzhiResultViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/11/14.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "ChongzhiResultViewController.h"
#import "JTCSM.h"
#import "MyDoubleLabelView.h"
static CGFloat top = 60;
static CGFloat iamgesize = 50;
static CGFloat space = 20;
static CGFloat btnspace = 40;
static CGFloat btnHeight = 50;

@interface ChongzhiResultViewController ()

@end

@implementation ChongzhiResultViewController

- (void)goBack{
    [self.navigationController popViewControllerAnimated:YES];
}  
- (void)noselector{
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.hidden = NO;
    [df isRemoveTarbar:YES];
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(noselector)];

    [self layoutsubview];
    // Do any additional setup after loading the view.
}

- (void)layoutsubview{
    [df lineViewWithHeightofTop:10 superView:self.view spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:10];
    UIImageView *imagev = [[UIImageView alloc]initWithFrame:CGRectMake((KCONTROLLERWith-iamgesize)/2, top, iamgesize, iamgesize)];
    imagev.image = [UIImage imageNamed:_isSuccess?@"icon_39@2x.png":@"icon_40@2x.png"];
    [self.view addSubview:imagev];
    
    MyDoubleLabelView *doubleView = [[MyDoubleLabelView alloc]initWithFrame:CGRectMake(0, KVIEW_Y(imagev)+top, KCONTROLLERWith, 0) titleFontsize:30 titlecolor:RGBACOLOR(89, 89, 89, 1) contentFontsize:20 contentcolor:RGBACOLOR(193, 193, 193, 1)];
    [doubleView setvalueWithModel:@{KDoubleLabelTitle:_titleString,KDoubleLabelContent:(_isSuccess?@"充值成功":@"充值失败")}];
    [self.view addSubview:doubleView];
    UILabel *label = [UILabel initWithFrame:CGRectMake(space, KVIEW_Y(doubleView)+top, KCONTROLLERWith-2*space, _isSuccess?40:0) text:@"建议您稍后查看或登录手机银行查看明细，已银行实际扣款为准." font:16 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(133, 133, 133, 1) backgroundColor:nil];
        [self.view addSubview:label];
    label.numberOfLines = 2;
    
    
    [df lineViewWithHeightofTop:KVIEW_Y(label) superView:self.view spacing:space color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
    
    UIButton *againBtn =[[UIButton alloc] initWithFrame:CGRectMake(btnspace,KVIEW_Y(label)+20 , (KCONTROLLERWith-2*btnspace), btnHeight)];
    againBtn.backgroundColor =RGBACOLOR(227, 68, 40, 1);
    [againBtn setTitle:@"继续充值" forState:UIControlStateNormal];
    [againBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [againBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:againBtn];
    [df layerWithView:againBtn radius:btnHeight/2 width:0 color:nil];
    if (_isSuccess) {
        UIButton *backButton =[[UIButton alloc] initWithFrame:CGRectMake(btnspace, KVIEW_Y(againBtn )+20 , (KCONTROLLERWith-2*btnspace), btnHeight)];
        backButton.backgroundColor = [UIColor whiteColor];
        [backButton setTitle:@"返回上级" forState:UIControlStateNormal];
        [backButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [backButton addTarget:self action:@selector(gorootBack) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:backButton];
        [df layerWithView:backButton radius:btnHeight/2 width:1 color:RGBACOLOR(227, 68, 40, 1)];
    }
    
}

- (void)gorootBack{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
